#!/bin/bash

#author sunbx@funshion.com
#date	2013-10-10
#服务器回退到拉回前上一版本，工作区也恢复为上一版本状态

#定义本地git仓库位置
git_repo="/root/workspace/$2"

cd $git_repo


git reset --hard HEAD^ > /dev/null
#git reset  HEAD^ > /dev/null

if [ $? -eq 0 ]
then
    echo "#####################" >&2
    echo "  SUCCESS!">&2
    echo "#####################">&2
else 
    echo "!!!!!!!!!!!!!!!!!!!!!">&2
    echo "  FAIL!">&2
    echo "!!!!!!!!!!!!!!!!!!!!!">&2
fi
